/**
 * 
 */
package dbManager;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Test;

/**
 * This class is for testing functions from class manager
 */
public class ManagerTest 
{
	/**
	 * Test method for {@link dbManager.Manager#count_parenthesis(java.lang.String, int)}.
	 */
	@Test
	public void testCount_parenthesis()
	{
		Manager manager = Manager.getInstance();
		assertEquals(17, manager.count_parenthesis("(texttexttexttext)", 0));
	}
	
	/**
	 * Test method for {@link dbManager.Manager#count_parenthesis(java.lang.String, int)}.
	 */
	@Test
	public void testCount_parenthesis2()
	{
		Manager manager = Manager.getInstance();
		assertEquals(7, manager.count_parenthesis("(t(a()r)e)", 2));
	}
	
	/**
	 * Test method for {@link dbManager.Manager#mergeAccordingOr(java.util.ArrayList, java.util.ArrayList)}.
	 */
	@Test
	public void testMergeAccordingOr()
	{
		Manager manager = Manager.getInstance();
		ArrayList<String> param1 = new ArrayList<String>();
		ArrayList<String> param2 = new ArrayList<String>();
		String[] result = new String[5];
		param1.add("a");
		param1.add("b");
		param1.add("c");
		param2.add("c");
		param2.add("d");
		param2.add("e");
		result[0] = "a";
		result[1] = "b";
		result[2] = "c";
		result[3] = "d";
		result[4] = "e";
		ArrayList<String> array_list_result = manager.mergeAccordingOr(param1, param2);
		String[] real_result = new String[array_list_result.size()];
		for (int i = 0; i < array_list_result.size(); i++) 
		{
			real_result[i] = array_list_result.get(i);
		}
		assertArrayEquals(result, real_result);
	}
	
	/**
	 * Test method for {@link dbManager.Manager#mergeAccordingAnd(java.util.ArrayList, java.util.ArrayList)}.
	 */
	@Test
	public void testMergeAccordingAnd()
	{
		Manager manager = Manager.getInstance();
		ArrayList<String> param1 = new ArrayList<String>();
		ArrayList<String> param2 = new ArrayList<String>();
		String[] result = new String[1];
		param1.add("a");
		param1.add("b");
		param1.add("c");
		param2.add("c");
		param2.add("d");
		param2.add("e");
		result[0] = "c";
		ArrayList<String> array_list_result = manager.mergeAccordingAnd(param1, param2);
		String[] real_result = new String[array_list_result.size()];
		for (int i = 0; i < array_list_result.size(); i++) 
		{
			real_result[i] = array_list_result.get(i);
		}
		assertArrayEquals(result, real_result);
	}

}
